package org.wejob.core.log.util.mpscqueue;

import org.wejob.core.log.MessageRecord;

public class MpscQueueTest {
    public static void main(String[]args){
        MpscArrayQueue queue=new MpscArrayQueue<>(10);
        for (long i=0;i<100000l;i++){
            if(i%2==0)
                queue.offer(new MessageRecord<>("to","1",i,1l));
            else{
                MessageRecord tmp=queue.poll();
                if(tmp==null)
                    return;
                System.out.println(tmp.message()+" "+tmp.offset());
            }
        }

    }
}
